<?php

declare (strict_types=1);

namespace App\Model;

use Hyperf\DbConnection\Model\Model;

/**
 * Class UserWithdraw
 * @package App\Model
 * @property int id
 * @property int user_id
 * @property int cooperative_id
 * @property int gold
 * @property int status
 * @property int is_self_merchant
 * @property int gold_type
 * @property string message
 * @property User user
 *
 */
class UserWithdraw extends Model
{
    protected $table = 'user_withdraw';

    public function user()
    {
        return $this->belongsTo(User::class,'user_id');
    }

    public function getAmountAttribute(){
        return bcdiv((string)$this->attributes['gold'],'100',2);
    }
}